package com.rock.code.bigdata.towpage.service.impl;

import com.rock.code.bigdata.towpage.dao.HostPageDao;
import com.rock.code.bigdata.towpage.service.HostPageService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
public class HostPageServiceImpl implements HostPageService {


    @Resource
    private HostPageDao hostPageDao;

    @Override
    public List queryTableInfoData(Map map) {
        return hostPageDao.queryTableInfoData(map);
    }

    @Override
    public List queryTableInfoData1(Map map) {
        return hostPageDao.queryTableInfoData1(map);
    }

    @Override
    public List queryYbpData(Map map) {
        return hostPageDao.queryYbpData(map);
    }

    @Override
    public List queryJkdData(Map map) {
        return hostPageDao.queryJkdData(map);
    }


    @Override
    public List queryTopData(Map map) {
        return hostPageDao.queryTopData(map);
    }


    @Override
    public String monthYearTableName() {
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date());
        cal.add(Calendar.MONTH, -1);
        String year = new SimpleDateFormat("yyyy").format(cal.getTime());
        return "tb_kpi_value_year_" + year;
    }

    @Override
    public String lastMonth() {
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date());
        cal.add(Calendar.MONTH, -1);
        String month = new SimpleDateFormat("yyyy-MM").format(cal.getTime());
        return month;
    }

    //====================================================================================

    @Override
    public List queryResourceNumber(Map map) {
        return hostPageDao.queryResourceNumber(map);
    }

    @Override
    public List queryResourceNumber1(Map map) {
        return hostPageDao.queryResourceNumber1(map);
    }
}